package com.kcloud.commons.authorization.settings.biz.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.kcloud.commons.entity.core.CtrlUnit;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Delegate;

/**
 * 用户业务功能权限
 * @author songhuiqing
 */
@Data
@TableName("@@USER_BIZ_FUNCTION@@")
public class UserBizFunction extends BaseClob{

    private String userConfigId;
    private String userId; //用户ID
    private String organizationId; //机构ID
    private String postId;//岗位ID
    private String positionId;//职位ID

    private String configId;// 业务功能配置id
    private String bizDomainCode;// 业务域编码

    public UserBizFunction() {
    }

    public UserBizFunction(CtrlUnit ctrlUnit, BizFunction f) {
        if(ctrlUnit != null) {
            this.userId = ctrlUnit.getUserId();
            this.organizationId = ctrlUnit.getOrganizationId();
            this.positionId = ctrlUnit.getPositionId();
        }
        if(f != null) {
            this.configId = f.getConfigId();
            this.bizDomainCode = f.getBizDomainCode();
            super.setOperations(f.getOperations());
            super.setAttributeGroups(f.getAttributeGroups());
        }
    }

}
